<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>签名列表</title>
    <link rel="stylesheet" href="${base}/layui/css/layui.css">
    <link rel="stylesheet" href="${base}/awesome/css/font-awesome.min.css">
     <link rel="stylesheet" href="${base}/css/admin.css">
    <style>
    	.layui-bg-black{        width: 200px;height: 136px;margin-right: 30px;float: left;text-align: center;font-size: 33px;color: #000000!important;padding-top: 30px;}
    	.hide {display: none;}
    	.checkbox{display: inline-block;}
    	.layui-form-item{font-size: 18px;}
    	.layui-input{display: inline-block;}
    	.width180 {width: 180px; margin-right: 20px;float: left;}
    </style>
</head>
<body  class="layui-layout-body" style="overflow:scroll;">
<#include "/common/left.flt">	
<div class="layui-main" style="position: absolute;left: 205px;top: 20px; width: calc(100% - 210px);" >
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
  <legend>操作提示</legend>
</fieldset>
<blockquote class="layui-elem-quote layui-quote-nm">
 	<form action="${base}/users_list/introList" method="post" id="dataForm">
        <input type="hidden" id="page" name="page"/>
        <div class="layui-input-inline">
        	<input placeholder="五十度id" name ="user_id" class="layui-input width180" value="${user_id?default('')}" title="不带20开头的." />
 			<input placeholder="签名" name ="content" class="layui-input width180" value="${content?default('')}" />
 			<button class="layui-btn" lay-submit=""> <span class="fa fa-search"></span> 查询</button>
 			<a class="layui-btn" id="del_x"> <span class="fa fa-trash"></span>批量删除</a>
 		</div>
 		
    </form>
</blockquote> 

<table class="layui-table" >
	<thead>
        <tr>
        	 <th><input type="checkbox" id="all" />用户id</th>
             <th  width="240px;">签名内容</th>
             <th>用户昵称</th>
             <th>性别</th>
             <th>常驻省份</th>
             <th>更新时间</th>
             <th>操作</th>
         </tr>
     </thead>
     <tbody>
     <#list page.list as one>
     <tr>
     	<td><input type="checkbox" name="id" value="${one.id}" /><a href="${base}/users_list/detail?user_id=${one.user_id}" target="_blank">${one.user_id}</a></td>
     	<td>${one.introduction?default('')}</td>
     	<td><script>document.write(decodeURIComponent("${one.nick_name?default('')}"));</script></td>
     	<td>${one.sex_name?default('')}</td>
     	<td>${one.area_name?default('')}</td>
     	<td>${one.create_time_string?default('')} </td>
     	<td><a onclick="del(${one.id});"><span class="fa fa-trash"></span></a></td>
     </tr>
     </#list>
     </tbody>
</table>
<div id="pageDiv"></div>
<form action="${base}/util/uploadFile" method="post" name="uploadForm" enctype="multipart/form-data" id="uploadForm" class="hide" >
    <input name="pic" type="file" id="pic" class="hide"/>
</form>
</body>
<script src="${base}/js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="${base}/layui/layui.all.js"></script>
<script type="text/javascript">
layui.use('laypage',function () {
    var laypage = layui.laypage ;
    laypage.render({
        elem:"pageDiv",
        count:${page.totalPage*30},
        limit:30,
        curr:${page.pageNumber},
        layout:['count','prev','page','next','skip'],
        jump:function (obj,first) {
            var page = obj.curr;
            if(!first){
                $("#page").val(page);
                $("#dataForm").submit();
            }
        }
    });
});
$("#all").click(function (){
	if ($("#all").prop("checked")) {
		$("input[name='id']").prop("checked", true);
	} else {
		$("input[name='id']").prop("checked", false);
	}
});

$("#del_x").click(function(){
	 try {
		 var ids = "";
			$('input[name="id"]:checked').each(function(){//遍历每一个名字为interest的复选框，其中选中的执行函数    
				ids = ids + $(this).attr("value")+",";
		    });
			if(ids){
				$.post("${base}/users_list/delIntroSelect",
				   		{"ids":ids},function(data){ 
				   			layer.msg(data);
				   		}
				    );
			}
   }catch(e) {
      console.log(e)
   }
});

var _id = 0 ;
$('body').bind('keyup', function(event) {
	　　if (event.keyCode == "13") {
	　　　　//回车执行查询
	　　　　_del();
	　　}
});
	
function _del(){
	console.log("_del " + _id);
	if (_id > 0 ){
		$.post("${base}/users_list/delIntro",
		   		{"id":_id},function(data){ 
		   			layer.msg(data);
		   			window.location.reload();
		   		}
		    );
	}
}

function del(id){
	_id = id;
	//询问框
	layer.confirm('确定要删除吗？', {
	  btn: ['确定'] //按钮
	}, function(){
		_del();
	});
}
</script>
</html>